const App = {
    mixins: [Save],//配置文件，路径/utils/mixins.js
    data() {
        return {
            Organization: [],
            Member: [],
            FeeTypeList: [
                { value: "正常", label: "正常" },
                { value: "补缴", label: "补缴" },
            ],
            
        };
    },
    mounted() {

        this.GetOrganization();

        this.dataForm.FeeType="正常";
    },
    methods: {
        changeFee_Date(val){
            let _this=this;
            _this.dataForm.Belonginterval=val.substring(0, 7);

        },

        changeOrganization(val) {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryBySQLSerialNumber`,
                type: "POST",
                data: {
                    SQLSerialNumber: 'f_party_member_information',
                    Condition: '',
                    ExtensionCondition: window.btoa(unescape(encodeURIComponent(" and Party_Organization_SerialNumber='" + val + "'"))),

                },
                success: (data) => {
                    this.Member = data; // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });

        },
        GetOrganization() {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/permissionsTree/getPartyOrganizationsTreeByPermissions`,
                type: "GET",
                data: {
                    PartyOrganizationsCode: getCookie('party'), //请求参数
                },
                success: (data) => {
                    const _this = this;
                    _this.Organization = _this.convertToCascaderFormat(data); // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });

        },
        validateInput() {
            let _this = this;
            if (_this.dataForm.Fee_Amount < 0) {
                _this.dataForm.Fee_Amount = 0;
            } else if (_this.dataForm.Fee_Amount > 9999) {
                _this.dataForm.Fee_Amount = 9999;
            }

            //_this.dataForm.Fee_Amount=parseFloat(_this.dataForm.Fee_Amount.toFixed(2))
        },
        convertToCascaderFormat(items) {
            const _this = this;
            console.log(items);
            return items.map((item) => ({
                label: item.Party_Organization_Name,
                value: item.Party_Organization_SerialNumber,
                // 递归处理子节点
                children: item.children
                    ? _this.convertToCascaderFormat(item.children)
                    : [],
            }));
        },

    },

};
const { createApp, ref } = Vue;
const app = createApp(App);
app.use(ElementPlus, { locale: zhCn });
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
app.component('yl-upload', ylUpload);
app.component('yl-select', ylSelect);
app.component('yl-text-editor', ylTextEditor);
const ElMessage = ElementPlus.ElMessage;
app.mount("#app");
